//
//  ViewController.m
//  28-AutoLayoutAnimation
//
//  Created by dllo on 16/8/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *centerY;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *left150;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *left20;

@property (weak, nonatomic) IBOutlet UIImageView *imageView1;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    _imageView1.transform = CGAffineTransformMakeTranslation(-300, 100);
    NSLog(@"加载");
    
}

- (IBAction)buttonClicked:(UIButton *)sender {
    self.centerY.constant = 200;
    
//    [UIView animateWithDuration:1 animations:^{
////        self.centerY.constant = -200;
//        [self.view layoutIfNeeded];
//    }];
    
//    约束的优先级，改变时需要注意不能为1000，优先级高的会被执行
    _left20.priority = 751;
    _left150.priority = 750;
    [UIView animateWithDuration:5 animations:^{
        [self.view layoutIfNeeded];
    }];
    
    
    
    
}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [UIView animateWithDuration:1 animations:^{
        _imageView1.transform = CGAffineTransformIdentity;
    }];
    NSLog(@"出现");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
